

// 将提示信息封装为一个函数,放入对象中
const common = {
    tip:function(status,msg){
        let div = document.createElement('div');
        div.className = 'toast';
        document.body.appendChild(div);
        div.innerHTML = `
            <i class="iconfont ${status==0?'icon-gantanhao1':'icon-duihao'}"></i>
            <span></span>
        `
        div.children[1].textContent = msg;
        // 1s后消失
        setTimeout(function(){
            div.remove();
        },1000)
    },

    footer:function(i=0){
        let footer = document.createElement('footer');
        footer.className = 'common';
        footer.innerHTML = `
            <a href="./index.html">
                <i class="iconfont icon-shouye-shouye"></i>
                <p>首页</p>
            </a>
            <a href="./course_training.html">
                <i class="iconfont icon-xintiaojiankangyundongyiliaobaohuxinshuai"></i>
                <p>运动</p>
            </a>
            <a href="./mine.html">
                <i class="iconfont icon-wode11"></i>
                <p>我的</p>
            </a>
        `
        document.body.appendChild(footer);
        footer.children[i].classList.add('on');
    }
}

// 将对象挂载到window中
window.common = common;
